<%
  var slugs = Object.keys(public.blog._data.posts);
  var blog = _.map(slugs, function(i) { return { 'slug': i, 'author': public.blog._data.posts[i].author, 'title': public.blog._data.posts[i].title, 'date': public.blog._data.posts[i].date, 'published': public.blog._data.posts[i].published }})
  blog = _.sortBy(blog, 'date').reverse()
%>

<section class="TutorialIndex Blog">
  <h1>Truffle Blog</h1>

  <ol class="list-unstyled">
    <% for(var post of blog){ %>
      <% if(!!post.published) { %>
        <li>
          <a href="/blog/<%= post.slug %>">
            <h2><%= post.title %></h2>

            <span>
              <date><%= post.date %></date> &bull; <span>BY <%=post.author %></span>
            </span>

            <div>Read Article &rarr;</div>
          </a>
        </li>
      <% } %>
    <% }; %>
  </ol>
</section>
